class BootStrap {

     def init = { servletContext ->
         if(!Container.findByName("IDA")){
             new Container(name:"IDA").save()
         }
         if(!Type.findByType("Lab")){
             new Type(type:"Lab").save()
         }
         if(!Type.findByType("Study Area")){
             new Type(type:"Study Area").save()
         }
         if(!Role.findByLevel("0")){
             new Role(level:0, description:"Developer").save()
         }
         if(!Role.findByLevel("1")){
             new Role(level:1, description:"Administrator").save()
         }
         if(!Role.findByLevel("2")){
             new Role(level:2, description:"Lab Leader").save()
         }
         if(!DevAccess.findByUserName("ADMIN")){
             def r = Role.findByLevel("0")
             new DevAccess(role:r, userName:"ADMIN", password:"admin").save()
         }

        if(!Help.findByName("project_list")){
             def r = Role.findByLevel("0")
             new Help(name:"project_list", language:"sv", helptext:"help").save()
             new Help(name:"project_list", language:"en", helptext:"help").save()
         }
         if(!Help.findByName("project_create")){
             def r = Role.findByLevel("0")
             new Help(name:"project_create", language:"sv", helptext:"help").save()
             new Help(name:"project_create", language:"en", helptext:"help").save()
         }
         if(!Help.findByName("project_edit")){
             def r = Role.findByLevel("0")
             new Help(name:"project_edit", language:"sv", helptext:"help").save()
             new Help(name:"project_edit", language:"en", helptext:"help").save()
         }
         if(!Help.findByName("project_show")){
             def r = Role.findByLevel("0")
             new Help(name:"project_show", language:"sv", helptext:"help").save()
             new Help(name:"project_show", language:"en", helptext:"help").save()
         }

        if(!Help.findByName("employee_list")){
             def r = Role.findByLevel("0")
             new Help(name:"employee_list", language:"sv", helptext:"help").save()
             new Help(name:"employee_list", language:"en", helptext:"help").save()
         }
         if(!Help.findByName("employee_create")){
             def r = Role.findByLevel("0")
             new Help(name:"employee_create", language:"sv", helptext:"help").save()
             new Help(name:"employee_create", language:"en", helptext:"help").save()
         }
         if(!Help.findByName("employee_edit")){
             def r = Role.findByLevel("0")
             new Help(name:"employee_edit", language:"sv", helptext:"help").save()
             new Help(name:"employee_edit", language:"en", helptext:"help").save()
         }
         if(!Help.findByName("employee_show")){
             def r = Role.findByLevel("0")
             new Help(name:"employee_show", language:"sv", helptext:"help").save()
             new Help(name:"employee_show", language:"en", helptext:"help").save()
         }

        DBConnection.connect()
        DBConnection.alterTableEngine("project")
        DBConnection.alterTableEngine("employee")
        DBConnection.alterTableEngine("whoa")
        DBConnection.closeAll()

        //employee list
        if(!Language.findByMsgID("Employee List")){
            new Language(msgID:"Employee List",msg:"Employee List", language:"en").save()
            new Language(msgID:"Employee List",msg:"Lista av anställda", language:"sv").save()
        }
        if(!Language.findByMsgID("Name")){
            new Language(msgID:"Name",msg:"Name", language:"en").save()
            new Language(msgID:"Name",msg:"Namn", language:"sv").save()
        }
        if(!Language.findByMsgID("Title")){
            new Language(msgID:"Title",msg:"Title", language:"en").save()
            new Language(msgID:"Title",msg:"Titel", language:"sv").save()
        }
        if(!Language.findByMsgID("Monthly Salary")){
            new Language(msgID:"Monthly Salary",msg:"Monthly Salary", language:"en").save()
            new Language(msgID:"Monthly Salary",msg:"Månadslön", language:"sv").save()
        }
        if(!Language.findByMsgID("Working")){
            new Language(msgID:"Working",msg:"Working", language:"en").save()
            new Language(msgID:"Working",msg:"Arbetar", language:"sv").save()
        }

        //employee create
        if(!Language.findByMsgID("Create Employee")){
            new Language(msgID:"Create Employee",msg:"Create Employee", language:"en").save()
            new Language(msgID:"Create Employee",msg:"Skapa anställd", language:"sv").save()
        }
        if(!Language.findByMsgID("Employee Id:")){
            new Language(msgID:"Employee Id:",msg:"Employee Id:", language:"en").save()
            new Language(msgID:"Employee Id:",msg:"Anställd Id", language:"sv").save()
        }
        if(!Language.findByMsgID("First Name:")){
            new Language(msgID:"First Name:",msg:"First Name:", language:"en").save()
            new Language(msgID:"First Name:",msg:"Förnamn:", language:"sv").save()
        }
        if(!Language.findByMsgID("Last Name:")){
            new Language(msgID:"Last Name:",msg:"Last Name:", language:"en").save()
            new Language(msgID:"Last Name:",msg:"Efternamn:", language:"sv").save()
        }
        if(!Language.findByMsgID("Street:")){
            new Language(msgID:"Street:",msg:"Street:", language:"en").save()
            new Language(msgID:"Street:",msg:"Gata:", language:"sv").save()
        }
        if(!Language.findByMsgID("City:")){
            new Language(msgID:"City:",msg:"City:", language:"en").save()
            new Language(msgID:"City:",msg:"Stad:", language:"sv").save()
        }
      
        if(!Language.findByMsgID("Zip Code:")){
            new Language(msgID:"Zip Code:",msg:"Zip Code:", language:"en").save()
            new Language(msgID:"Zip Code:",msg:"Postnummer:", language:"sv").save()
        }
        if(!Language.findByMsgID("Dob:")){
            new Language(msgID:"Dob:",msg:"Dob:", language:"en").save()
            new Language(msgID:"Dob:",msg:"Födelsedatum:", language:"sv").save()
        }
        if(!Language.findByMsgID("Email:")){
            new Language(msgID:"Email:",msg:"Email:", language:"en").save()
            new Language(msgID:"Email:",msg:"Email:", language:"sv").save()
        }
        if(!Language.findByMsgID("Hired By:")){
            new Language(msgID:"Hired By:",msg:"Hired By:", language:"en").save()
            new Language(msgID:"Hired By:",msg:"Anställd av:", language:"sv").save()
        }
        if(!Language.findByMsgID("Title:")){
            new Language(msgID:"Title:",msg:"Title:", language:"en").save()
            new Language(msgID:"Title:",msg:"Titel:", language:"sv").save()
        }
        if(!Language.findByMsgID("Salary:")){
            new Language(msgID:"Salary:",msg:"Salary:", language:"en").save()
            new Language(msgID:"Salary:",msg:"Lön:", language:"sv").save()
        }
        if(!Language.findByMsgID("Percentage Work:")){
            new Language(msgID:"Percentage Work:",msg:"Percentage Work:", language:"en").save()
            new Language(msgID:"Percentage Work:",msg:"Procent arbete:", language:"sv").save()
        }
        if(!Language.findByMsgID("Phone Number:")){
            new Language(msgID:"Phone Number:",msg:"Phone Number:", language:"en").save()
            new Language(msgID:"Phone Number:",msg:"Telefonnummer:", language:"sv").save()
        }
        if(!Language.findByMsgID("Create")){
            new Language(msgID:"Create",msg:"Create", language:"en").save()
            new Language(msgID:"Create",msg:"Skapa", language:"sv").save()
        }
                //project list
                //project create
                //budget list
                //budget create

         /*if(!Language.findByMsgID("")){
            new Language(msgID:"",msg:"", language:"en").save()
            new Language(msgID:"",msg:"", language:"sv").save()
        }*/
     }
     def destroy = {
     }
}
